package learn.basics.abstract1;

abstract class Animal{
    public abstract void Eat();
}

class Cat extends Animal{

    @Override
    public void Eat() {
        System.out.println("这是猫");
    }
}

class Demo{
    public static void Test(){
        Cat cat=new Cat();
        cat.Eat();
    }
}

abstract class Fu{
    public Fu(){
        System.out.println("抽象父类构造方法执行！");
    }
    public abstract void Eat();

    public void Method(){
        System.out.println("父类中的方法");
    }
}

class Zi extends Fu{

    public Zi(){
        System.out.println("子类构造方法执行！");
    }

    @Override
    public void Eat() {
        System.out.println("吃饭");
    }


}

class DemoAbstract{
    public static void Test(){
        Zi zi=new Zi();
        zi.Eat();
        zi.Method();
    }
}

public class TestAbstract {

    public static void main(String[] args) {
        //Demo.Test();
        DemoAbstract.Test();
    }
}
